/**
 * reduce 返回 
 * 如果数组和initValue都为空时会出现TypeError的错误
 * @param {*} callback 
 * @param {*} initValue 
 * @returns 
 */
Array.prototype.myReduce = function (callback, initValue) {
    let start = 0
    if (initValue) {
        pre = initValue
    } else {
        pre = this[0]
        start = 1
    }
    for (let i = start; i < this.length; i++) {
        pre = callback(pre,this[start],i,this)
    }
    return pre
}